From b76b220b8ede1c3048c18c6abbaf384604ac8012 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Fri, 23 Dec 2011 11:44:14 +0000 Subject: [PATCH] base: remove unused model-cmyk --- babl/base/model-cmyk.c | 213 ----------------------------------------- 1 file changed, 213 deletions(-) delete mode 100644 babl/base/model-cmyk.c diff --git a/babl/base/model-cmyk.c b/babl/base/model-cmyk.c deleted file mode 100644 index 19ef1c9..0000000 --- a/babl/base/model-cmyk.c +++ /dev/null @@ -1,213 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see - * . - */ - -#include "config.h" -#include -#include -#include -#include "babl.h" - -#include "util.h" - -static void components (void); -static void models (void); -static void conversions (void); -static void formats (void); - -void -babl_base_model_cmyk (void) -{ - components (); - models (); - conversions (); - formats (); -} - -static void -components (void) -{ - babl_component_new ( - "cyan", - "id", BABL_CYAN, - NULL); - - babl_component_new ( - "yellow", - "id", BABL_YELLOW, - NULL); - - babl_component_new ( - "magenta", - "id", BABL_MAGENTA, - NULL); - - babl_component_new ( - "key", - "id", BABL_KEY, - NULL); -} - -static void -models (void) -{ - babl_model_new ( - "cmy", - "id", BABL_CMY, - babl_component_id (BABL_CYAN), - babl_component_id (BABL_MAGENTA), - babl_component_id (BABL_YELLOW), - NULL - ); - babl_model_new ( - "cmyk", - "id", BABL_CMYK, - babl_component_id (BABL_CYAN), - babl_component_id (BABL_MAGENTA), - babl_component_id (BABL_YELLOW), - babl_component_id (BABL_KEY), - NULL - ); - - babl_model_new ( - "cmyka", - "id", BABL_CMYKA, - babl_component_id (BABL_CYAN), - babl_component_id (BABL_MAGENTA), - babl_component_id (BABL_YELLOW), - babl_component_id (BABL_KEY), - babl_component_id (BABL_ALPHA), - NULL - ); -} - -static long -rgb_to_cmyk (void *src, - void *dst, - long n) -{ - while (n--) - { - double red = ((double *) src)[0]; - double green = ((double *) src)[1]; - double blue = ((double *) src)[2]; - - double cyan, magenta, yellow, key; - - double pullout = 1.0; - - cyan = 1.0 - red; - magenta = 1.0 - green; - yellow = 1.0 - blue; - - key = 1.0; - if (cyan < key) key = cyan; - if (magenta < key) key = magenta; - if (yellow < key) key = yellow; - - key *= pullout; - - if (key < 1.0) - { - cyan = (cyan - key) / (1.0 - key); - magenta = (magenta - key) / (1.0 - key); - yellow = (yellow - key) / (1.0 - key); - } - else - { - cyan = 0.0; - magenta = 0.0; - yellow = 0.0; - } - - ((double *) dst)[0] = cyan; - ((double *) dst)[1] = magenta; - ((double *) dst)[2] = yellow; - ((double *) dst)[3] = key; - - src += 4 * sizeof (double); - dst += 4 * sizeof (double) - } - return n; -} - -static long -cmyk_to_rgb (void *src, - void *dst, - long n) -{ - while (n--) - { - double cyan = ((double *) src)[0]; - double yellow = ((double *) src)[1]; - double magenta = ((double *) src)[2]; - double key = ((double *) src)[3]; - - double red, green, blue; - - if (key < 1.0) - { - cyan = cyan * (1.0 - key) + key; - magenta = magenta * (1.0 - key) + key; - yellow = yellow * (1.0 - key) + key; - } - else - { - cyan = magenta = yellow = 1.0; - } - - red = 1.0 - cyan; - green = 1.0 - magenta; - blue = 1.0 - yellow; - - ((double *) dst)[0] = red; - ((double *) dst)[1] = green; - ((double *) dst)[2] = blue; - - ((double *) dst)[3] = 1.0; - - src += 4 * sizeof (double); - dst += 4 * sizeof (double) - } - return n; -} - -static void -conversions (void) -{ - babl_conversion_new ( - "babl-base: rgba to cmyk", - "source", babl_model_id (BABL_RGBA), - "destination", babl_model_id (BABL_CMYK), - "linear", rgb_to_cmyk, - NULL - ); - - - babl_conversion_new ( - "babl-base: cmyk to rgba", - "source", babl_model_id (BABL_CMYK), - "destination", babl_model_id (BABL_RGBA), - "linear", cmyk_to_rgb, - NULL - ); -} - -static void -formats (void) -{ -} -- 2.30.2